package bdd;

import java.sql.PreparedStatement;

public class BddEtatCommandeInsert {

	@SuppressWarnings("unused")
	private static boolean insertEtatCommande(Integer id_etatCommande, String nomEtatCommande)throws Exception 
	{
		String query = null;
		PreparedStatement preparedstatement = null;
		query = "INSERT INTO ETATCOMMANDE (id_etatCommande, nomEtatCommande) ";
		query += "VALUES (?, ?)";

		preparedstatement = BddPreparedStatement.getPrepareStatement(query, true);
		preparedstatement.setInt(1, id_etatCommande);
		preparedstatement.setString(2, nomEtatCommande);

		try {
			BddConnector.insertInDatabase(preparedstatement);
		}
		catch (Exception e) {
			e.printStackTrace();
			preparedstatement.getConnection().rollback();
			preparedstatement.close();
			return false;
		}

		return true;
	}
}
